//
//  WNNotVC.swift
//  WalkNovel
//
//  Created by Kevin on 2024/1/3.
//

import UIKit
import UserNotifications

class WNNotVC: WNBaseVC {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func dataConfig() {
        let content = UNMutableNotificationContent()
        content.title = "Popular book recommendations"
        content.body = "My Vampire Guardian - The emotional bond between the vampire teacher and the female student"
        content.userInfo = ["bookId": "202308281693204478", "content_available": 1]
        let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false)
        //设置请求标识符
        let requestIdentifier = "com.dream.novle.NotificationService"
        //设置一个通知请求
        let request = UNNotificationRequest(identifier: requestIdentifier, content: content, trigger: trigger)
        //将通知请求添加到发送中心
        UNUserNotificationCenter.current().add(request) { error in
            if error == nil {
                print("Time Interval Notification scheduled: \(requestIdentifier)")
            }
        }
    }
}
